<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core">
    <ui:composition template="templateadmin.xhtml">
        <ui:define name="content">
            <h:form>
                <table border="0" cellpadding="0" cellspacing="0" id="product-table">
                    <tr>
                        <!--                        <th class="table-header-repeat line-left minwidth-1" width="120px"><a href="">Flight ID</a>	</th>-->
                        <th class="table-header-repeat line-left minwidth-1" width="220px"><a href="">Flight Name</a></th>
                        <th class="table-header-repeat line-left minwidth-1" width="220px"><a href="">Depart Time</a></th>
                        <th class="table-header-repeat line-left minwidth-1" width="220px"><a href="">Arrival Time</a></th>
                        <th class="table-header-repeat line-left minwidth-1" width="220px"><a href="">Depart Location</a></th>
                        <th class="table-header-repeat line-left minwidth-1" width="220px"><a href="">Arrival Location</a></th>
                        <th class="table-header-repeat line-left minwidth-1" width="100px"><a href="">Option</a></th>
                    </tr>
                    <ui:repeat value="#{mngFlightBean.listFlight}" var="flight">
                        <tr>
<!--                            <td>#{flight.flightID}</td>-->
                            <td>
                                <h:inputText id="txtName" value="#{flight.flightName}" styleClass="inp-form" required="true" requiredMessage="This field is required."></h:inputText>
                                <br/>
                                <h:message for="txtName" styleClass="error-inner" ></h:message>
                            </td>
                            <td>
                                <h:inputText id="txtDeTime" value="#{flight.departTime}" styleClass="inp-form" required="true" requiredMessage="This field is required."></h:inputText>
                                <br/>
                                <h:message for="txtDeTime" styleClass="error-inner"></h:message>
                            </td>
                            <td>
                                <h:inputText id="txtArrTime" value="#{flight.arrTime}" styleClass="inp-form" required="true" requiredMessage="This field is required."></h:inputText>
                                <br/>
                                <h:message for="txtArrTime" styleClass="error-inner"></h:message>
                            </td>
                            <td>
                                <h:selectOneMenu value="#{flight.departLocal}" styleClass="styledselect_form_1">
                                    <f:selectItems value="#{mngFlightBean.listLocation}" var="local" itemValue="#{local.locationID}" itemLabel="#{local.locationName}"></f:selectItems>
                                </h:selectOneMenu>
                            </td>
                            <td>
                                <h:selectOneMenu value="#{flight.arrLocal}" styleClass="styledselect_form_1">
                                    <f:selectItems value="#{mngFlightBean.listLocation}" var="local" itemValue="#{local.locationID}" itemLabel="#{local.locationName}"></f:selectItems>
                                </h:selectOneMenu>
                            </td>
                            <td>
                                <h:commandButton action="#{mngFlightBean.updateFlightAction(flight)}" value="Update" styleClass="form-update" onclick="show_alert()"></h:commandButton>
                            </td>
                        </tr>
                    </ui:repeat>
                </table>
            </h:form>
            <h:form>
                <table border="0" cellpadding="0" cellspacing="0" id="product-table" >
                    <tr>
                        <th class="table-header-repeat line-left minwidth-1" width="220px"><a href="">Flight Name</a></th>
                        <th class="table-header-repeat line-left minwidth-1" width="220px"><a href="">Depart Time</a></th>
                        <th class="table-header-repeat line-left minwidth-1" width="220px"><a href="">Arrival Time</a></th>
                        <th class="table-header-repeat line-left minwidth-1" width="220px"><a href="">Depart Location</a></th>
                        <th class="table-header-repeat line-left minwidth-1" width="220px"><a href="">Arrival Location</a></th>
                        <th class="table-header-repeat line-left minwidth-1" width="100px"><a href="">Option</a></th>
                    </tr>
                    <tr>
                        <td>
                            <h:inputText id="txtNameNew" value="#{mngFlightBean.flight.flightName}" styleClass="inp-form" required="true" requiredMessage="This field is required."></h:inputText>
                            <br/>
                            <h:message for="txtNameNew" styleClass="error-inner"></h:message>
                        </td>
                        <td>
                            <h:inputText id="txtDeTimeNew" value="#{mngFlightBean.flight.departTime}" styleClass="inp-form" required="true" requiredMessage="This field is required."></h:inputText>
                            <br/>
                            <h:message for="txtDeTimeNew" styleClass="error-inner"></h:message>
                        </td>
                        <td>
                            <h:inputText id="txtArrTimeNew" value="#{mngFlightBean.flight.arrTime}" styleClass="inp-form" required="true" requiredMessage="This field is required."></h:inputText>
                            <br/>
                            <h:message for="txtArrTimeNew" styleClass="error-inner"></h:message>
                        </td>
                        <td>
                            <h:selectOneMenu value="#{mngFlightBean.flight.departLocal}" styleClass="styledselect_form_1">
                                <f:selectItems value="#{mngFlightBean.listLocation}" var="local" itemValue="#{local.locationID}" itemLabel="#{local.locationName}"></f:selectItems>
                            </h:selectOneMenu>
                        </td>
                        <td>
                            <h:selectOneMenu value="#{mngFlightBean.flight.arrLocal}" styleClass="styledselect_form_1">
                                <f:selectItems value="#{mngFlightBean.listLocation}" var="local" itemValue="#{local.locationID}" itemLabel="#{local.locationName}"></f:selectItems>
                            </h:selectOneMenu>
                        </td>
                        <td>
                            <h:commandButton action="#{mngFlightBean.newFlightAction}" value="Update" styleClass="form-update" onclick="show_alert()"></h:commandButton>
                        </td>
                    </tr>
                </table>
            </h:form>
        </ui:define>
    </ui:composition>
</html>

